<template>
	<view class="mp-entry" v-if="show">
		<view class="item home" @tap="goHome">
			<basic-icons name="icon-home" size="50rpx" :color="page=='home'?'#1B2431':'#8D98AF'" />
			<text class="text" :class="{active:page=='home'}">首页</text>
		</view>
		<view class="item" @tap="goOrder">
			<basic-icons name="icon-order" size="50rpx" :color="page=='order'?'#1B2431':'#8D98AF'" />
			<text class="text" :class="{active:page=='order'}">订单</text>
		</view>
	</view>
</template>
<script>
import sdk from 'sdk'
export default {
	name: 'mp-entry',
	props: {
		page: { type: String, default:'home' }
	},
	data(){
		return {
			show: false
		}
	},
	mounted(){
		if(process.env.NODE_ENV === 'development'){
			this.show = true
		}
	},
	methods: {
		goHome(){
			sdk.redirectTo({
				url:'/pages/index/index'
			})
		},
		goOrder(){
			sdk.redirectTo({
				url:'/pages/order/index'
			})
		}
	}
}
</script>
<style lang="less">
.mp-entry{
	width: 242rpx;
	height: 100rpx;
	background: #FFFFFF;
	box-shadow: 0px 4rpx 20rpx 0px rgba(0, 0, 0, 0.05);
	border-radius: 50rpx;
	opacity: 0.98;
	position: fixed;
	bottom: 84rpx;
	right: calc(50% - 121rpx );
	z-index: 1000;
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 0 20rpx;
	.item{
		padding: 0 30rpx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}
	.home{
		border-right: 1px solid #FAFAFA;
	}
	.text{		
		font-size: 20rpx;
		color: #8D98AF;
		&.active{
			color: #1B2431;
		}
	}
}
</style>